#include<iostream>
#include<unistd.h>
using namespace std;

//using VFUNC = function<void()>;
typedef void(*VFUNC)();
class A {
public:
	virtual void func1() {
		cout << "A:func1" << endl;
	}

	virtual void func2() {
		cout << "A:func2" << endl;
	}
};

class B :public A {
public:
	void func1() {
		cout << "B:func1" << endl;
	}

	void func2() {
		cout << "B:func2" << endl;
	}
	virtual void func3() {
		cout << "B:func3" << endl;
	}

	virtual void func4() {
		cout << ":func4" << endl;
	}
};

void PrintVFT(VFUNC* a) {
	for (int i = 0; a[i]; i++) {
		printf("[%d]:%p->", i, a[i]);
		VFUNC f = a[i];
		f();
	}
	cout << endl;
}


int main() {
	A a;
	B b;
	PrintVFT((VFUNC*)(*((int*)&a)));
	PrintVFT((VFUNC*)(*((int*)&b)));
	return 0;
}
